package com.tnr.scgcxx.service.safty.impl;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.tnr.scgcxx.dao.safty.UserDao;
import com.tnr.scgcxx.dto.CurrUserDto;
import com.tnr.scgcxx.dto.UserDto;
import com.tnr.scgcxx.model.User;
import com.tnr.scgcxx.service.safty.LoginService;

@Service
public class LoginServiceImpl implements LoginService {
	
	@Resource
	private UserDao userDao;

	@Override
	public CurrUserDto login(UserDto userDto) {
		User  user = userDao.findUserByUidAndPwd(userDto);
		if(user!=null) {
			
			CurrUserDto currUser = new CurrUserDto();
			
			currUser.setUserId(user.getU_id());
			currUser.setUserName(user.getU_name());
			
			return currUser;
		}
		
		return null;
	}
		
		

}
